<?php

namespace Gds\VenteBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

class BonCommandeClientType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
         $builder
            ->add('date','date',array('widget'=>'single_text','format'=>'dd/MM/yyyy'))
            ->add('reference')
            ->add('client')
            ->add('lignes_bon_commande','collection', array('type'   => new LigneBonCommandeClientType(),
                                              'allow_add'    => true,
                                              'allow_delete' => true,
                                              'by_reference' => false))
        ;
    }

    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'Gds\VenteBundle\Entity\BonCommandeClient'
        ));
    }

    public function getName()
    {
        return 'gds_ventebundle_boncommandeclienttype';
    }
}
